#include<stdio.h> 
int main ()
{
int n,i,figure,a,b,c,m,sum;
double average=0;
i=a=b=c=sum=0;
scanf("%d" ,&n);
for (i=1;i<=n;i++)
{
scanf("%d",&figure);
m=figure%3;
switch(m)
{
case 0:if(a<figure)
a=figure;
break;
case 1:b++;
break;
case 2:c++;
sum=sum+figure;
break; 
}
}
average=sum*1.0/c;
if(a==0)
printf("NONE ");
else
printf( "%d ",a);
if (b==0)
printf("NONE ");
else
printf("%d ",b);
if (c==0)
printf( "NONE");
else
printf("%.1lf",average);

}
